﻿<!DOCTYPE html>

<html>
<head>
<!--
  Copyright (c) 2016-2017 Jean-Marc VIGLINO, 
  released under CeCILL-B (french BSD like) licence: http://www.cecill.info/
-->	
  <title>ol-ext: Pencil sketch map</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <meta name="description" content="Turn an ol map or layer into a pencil lsketch." />
  <meta name="keywords" content="ol, openlayers, filter, pencil, sketch" />

  <link rel="stylesheet" href="../style.css" />

  <!-- jQuery -->
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
  <!-- FontAwesome -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

  <!-- Openlayers -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@latest/ol.css" />
  <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ol@latest/dist/ol.js"></script>
  <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL,Object.assign"></script>
  
  <!-- ol-ext -->
  <link rel="stylesheet" href="../../dist/ol-ext.css" />
  <script type="text/javascript" src="../../dist/ol-ext.js"></script>
  <!-- Pointer events polyfill for old browsers, see https://caniuse.com/#feat=pointer -->
  <script src="https://unpkg.com/elm-pep"></script>

  <style>
  </style>

</head>
<body >
  <a href="https://github.com/Viglino/ol-ext" class="icss-github-corner"><i></i></a>

  <a href="../../index.html">
    <h1>ol-ext: Pencil sketch map</h1>
  </a>
  <div class="info">
    The <i>ol/filter/PencilSketch</i> turns any layer into a pencil sketch...
  </div>

  <!-- Map div -->
  <div id="map" style="width:600px; height:400px;"></div>

  <div class="options" >
    <ul>
      <li>
        <label>
          <input onchange="pencil.setActive($(this).prop('checked'));" type="checkbox" checked="checked" /> active
        </label>
      </li>
      <li>
        value: <input onchange="pencil.set('intensity', this.value);" type="range" min="0" max="1" step=".1" value=".8" />
      </li>
      <li>
        blur: <input onchange="pencil.set('blur', this.value);" type="range" min="0" max="20" step="1" value="8" />
      </li>
      <li>
        <label>
          <input onchange="pencil.set('color', $(this).prop('checked'));" type="checkbox" /> color
        </label>
      </li>
    </ul>
  </div>

  <script type="text/javascript">

    var layers = [ 
      new ol.layer.Tile({ source: new ol.source.OSM(), title:'OSM', baseLayer: true}),
      new ol.layer.Geoportail({ layer: 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2', visible: false, baseLayer: true}),
      new ol.layer.Geoportail({ layer: 'ORTHOIMAGERY.ORTHOPHOTOS', visible: false, baseLayer: true}),
    ];

    // The map
    var map = new ol.Map({
      target: 'map',
      view: new ol.View({
        zoom: 8,
        center: [247044, 6549736.]
      }),
      layers: layers
    });
    map.addControl(new ol.control.LayerSwitcher());

    // Custom filter
    var pencil = new ol.filter.PencilSketch();
    layers.forEach(function(l) {
      l.addFilter(pencil);
    });

    map.addControl(new ol.control.Permalink({ visible: false }));

  </script>

</body>
</html>